import { post,postFormData } from '@/request/http'
import store from '@/store'

// 获取 解决方案列表  查询数据
export const getSolveListService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/getProductList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            pdtStart: data.startPlace || '',
            pdtDesti: data.endPlace || '',
            pdtStatus: data.status || '',
          }
        }
      }
    }
  )
// 获取 解决方案列表  新增
export const addSolveService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/addProduct',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            pdtCreator: store.state.user.USR_CODE_DX_H,
            // pdtLstmodifier: store.state.user.USR_CODE_DX_H,
            pdtEtpId: store.state.user.FLT_UUID_DX_H,
            pdtStart: data.startPlace,
            pdtDesti: data.endPlace,
            pdtStartaddress: data.startPort,
            pdtDestination: data.endPort,
            pdtRecommend: data.routeRadio,
            pdtTransportationsort: data.transport,
            pdtDate: data.workDays,
            pdtIE: data.inOutRadio,
            pdtImageurl: data.pdtImageurl,
            pdtSttime: data.startTime,
            pdtEdtime: data.endTime,
            pdtRemark: data.desc,
            sysOrdProductPrice: data.sysOrdProduct,
            sysOrdProduct: data.sysOrdProductPrice
          }
        }
      }
    }
  )
// 获取 解决方案列表  编辑
export const editSolveService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/deitProduc',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            // pdtCreator: store.state.user.USR_CODE_DX_H,
            pdtLstmodifier: store.state.user.USR_CODE_DX_H,
            pdtEtpId: store.state.user.FLT_UUID_DX_H,
            stnLstmodifier: store.state.user.USR_CODE_DX_H,
            pdtId: data.pdtId,
            pdtStart: data.startPlace,
            pdtDesti: data.endPlace,
            pdtStartaddress: data.startPort,
            pdtDestination: data.endPort,
            pdtRecommend: data.routeRadio,
            pdtTransportationsort: data.transport,
            pdtDate: data.workDays,
            pdtIE: data.inOutRadio,
            pdtImageurl: data.pdtImageurl,
            pdtSttime: data.startTime,
            pdtEdtime: data.endTime,
            pdtRemark: data.desc,
            sysOrdProductPrice: data.sysOrdProduct,
            sysOrdProduct: data.sysOrdProductPrice
          }
        }
      }
    }
  )
// 获取 解决方案列表  删除
export const delSolveService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/deleteProduc',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            pdtId: data.pdtId,
          }
        }
      }
    }
  )

// 获取 解决方案明细列表  查询数据
export const getSolveDetailService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/getProductToList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            stnPdtId: data.stnPdtId,
          }
        }
      }
    }
  )

// 获取 解决方案  箱类型  下拉数据
export const getBoxService = () =>
  post(
    '/FTKJWLHYPT/dropDown/GetContainerTypes',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            ctpCommcode: '',
            ctpName: '',
          }
        }
      }
    }
  )

// 获取 解决方案  尺寸  下拉数据
export const getSizeService = () =>
  post(
    '/FTKJWLHYPT/dropDown/GetModelContatinerSizes',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            cszCsizecd: '',
            cszCsizenm: '',
            cszName: '',
          }
        }
      }
    }
  )

// 获取 解决方案  供应商  下拉数据
export const getApplyService = () =>
  post(
    '/FTKJWLHYPT/base/seletSysCompanyInfos',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            fltCode: '',
            fltName: '',
            fltPorts: '',
          }
        }
      }
    }
  )

// 获取 解决方案  经营人  下拉数据
export const getPeopleList = () =>
  post(
    '/FTKJWLHYPT/base/tmShiplnesModelList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            splCode: '',
            splName: '',
          }
        }
      }
    }
  )

//  解决方案  发布
export const releaseService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/changeReleas',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            pdtReleasecreator: store.state.user.USR_CODE_DX_H,
            pdtId: data.pdtId
          }
        }
      }
    }
  )

//  解决方案  取消发布
export const delReleaseService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/cancelReleas',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            pdtLstmodifier: store.state.user.USR_CODE_DX_H,
            pdtId: data.pdtId
          }
        }
      }
    }
  )

//  解决方案  置顶
export const makeTopService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/pdtTop',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            pdtId: data.pdtId,
            pdtLstmodifier: store.state.user.USR_CODE_DX_H,
          }
        }
      }
    }
  )

//  解决方案  取消置顶
export const delTopService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/cancelTop',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            pdtId: data.pdtId,
            pdtLstmodifier: store.state.user.USR_CODE_DX_H,
          }
        }
      }
    }
  )

//  解决方案  弹窗   基础信息  右侧箱信息  删除
export const delBoxInfoService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/delPrice',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            ptpId: data.pdtId,
          }
        }
      }
    }
  )

//  解决方案  弹窗   解决方案明细    删除
export const delSolveMethodsService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/delDetail',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            stnId: data.stnId,
          }
        }
      }
    }
  )

// 获取 解决方案  起始地，目的地  下拉框
export const placeService = () =>
  post(
    '/FTKJWLHYPT/dropDown/getqueryCtiyetList',{}
  )
// 获取 解决方案  起始，目的港站  下拉框
// export const portService = () =>
//   post(
//     '/FTKJWLHYPT/dropDown/getqueryProductList'
//   )
export const portService = (data) =>
  post(
    '/FTKJWLHYPT/freightForwardBusiness/getPorts', {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            potCtyeCode: data.potCtyeCode
          }
        }
      }
    }
  )

// 获取 上传 图片
export const uploadImg = (data) => {
  const formData = new FormData()
  formData.append('image', data.fileStyle)
  return postFormData(
    '/FTKJWLHYPT/base/addImg',formData
  )
}
